﻿using System;
using System.Collections.Generic;
using AppCommon;
using Model;

public partial class DattourStep3 : System.Web.UI.Page
{
    public static string _idTour;
    public static ModelVYC11 _khachhangInfo;
    public static List<ModelVYC12> listKh_dattour;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            var idTour = Request.QueryString["Id"];
            if (!string.IsNullOrEmpty(idTour))
            {
                _idTour = idTour;
                _khachhangInfo = (ModelVYC11)Session["InfoGuest"];
                listKh_dattour = (List<ModelVYC12>)Session["ListGuest"];
                if (_khachhangInfo == null || listKh_dattour == null)
                {
                    Response.Redirect("~/404.aspx");
                }
                BindData();
            }
            
        }
    }

    public void BindData()
    {
        litNgaydangky.Text = _khachhangInfo.NgayCapNhat.ToString();
        litHanthanhtoan.Text = _khachhangInfo.NgayCapNhat.AddDays(2).ToString();
        litHttt.Text = HinhThucThanhToan(_khachhangInfo.IdHinhThucThanhToan);
        litTencongty.Text = _khachhangInfo.TenCongTy;
        litHovaten.Text = _khachhangInfo.HoTen;
        litDiachi.Text = _khachhangInfo.DiaChi;
        litSodienthoai.Text = _khachhangInfo.SDT;
        litEmail.Text = _khachhangInfo.Email;
        litDidong.Text = _khachhangInfo.DiDong;
        litMst.Text = _khachhangInfo.MST;
        litCmnd.Text = _khachhangInfo.CMND;
        litTsk.Text = _khachhangInfo.SoLuong.ToString();

        repeaterDskh.DataSource = listKh_dattour;
        repeaterDskh.DataBind();
    }

    public string HinhThucThanhToan(int id)
    {
        return id == 1 ? Constants.HTTT_Tienmat : (id == 2 ? Constants.HTTT_Chuyenkhoan : Constants.HTTT_Thetindung);
    }

    protected void btChapnhan_OnClick(object sender, EventArgs e)
    {
        if (cbDongy.Checked)
        {
            
        }
        else
        {
            litResult.Text = "Bạn chưa chọn 'Tôi đồng ý với các điều khoản trên' ";
            BindData();
            return;
        }
        Response.Redirect("~/" + "dattour/" + _idTour + "/vyc-xacnhan");
    }
}